home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / msdos / raytrace / pov / gen / prepov05 / prepov05.doc < prev    next >
Text File  |  1993-02-11  |  6KB  |  255 lines

  1. ================================================================ PREPOV 0.5
  2. Pre-Processor for PoVRay 1.0           RMB  Compuserve 73050,261
  3. ================================================================ Feb /93
  4.  
  5.                  --- F R E E W A R E ---    USE IT !!!
  6.  
  7. - Prepov is a "preprocessor", that means it need a Input File (ascii) and the
  8.   Output is another ascii file processed.
  9.  
  10. - Usage :    PREPOV05 Input Output
  11.         where Input is the file to process and Output is the file processed,
  12.         you have to enter the complete name of the file WITH EXETENSION.
  13.         The program override the Output file, if it exist, so take care.
  14.  
  15. - Ej.   PREPOV05 example.pre example.pov
  16.  
  17.  
  18. ============================== SYNTAXIS =====================================
  19.  
  20. Constants.
  21. -----------------------------------------------------------------------------
  22.  
  23.    Prepov replaces in the input file all the ocurrences between "[" and "]",
  24. with the value of the formula evaluated.
  25.  
  26. Ej.
  27.    Input
  28.        object {
  29.                sphere {< [1+1] [ 4/2] [ (2.5+1.5)/2 ]> [8/4] > }
  30.               }
  31.    Output
  32.        object {
  33.                sphere {< 2.0 2.0 2.0> 2.0 > }
  34.               }
  35.  
  36.  
  37. Var's
  38. -----------------------------------------------------------------------------
  39.  
  40.    With Preprov you can define var's and then use them in your file.
  41. The var's name are 00 to 99 and you define them with the "#" character
  42. and use them with the "@" character.
  43.  
  44. Ej.
  45.  
  46.    Input
  47.  
  48.       #01 = 1.5
  49.       #23 = 2.5
  50.  
  51.       object {
  52.                sphere {< [1+1] 2 [ (@23+@01)/2 ]> [8/4] > }
  53.              }
  54.  
  55.    Output
  56.  
  57.       // #01 = 1.5
  58.       // #23 = 2.5
  59.  
  60.       object {
  61.                sphere {< 2.0 2 2.0> 2.0 > }
  62.               }
  63.  
  64.  
  65.    You can use the var's in any order, but TAKE CARE to define only one var
  66. per line and nothing else! in that line. You can use the var's in where you
  67. want any number of times. Is posible to re-define the var's where you want.
  68. If you use a var with no definition it has the value 0.0 (cero).
  69.    REMEMBER to put the formula between  "[ ]"
  70.  
  71. Ej.
  72.  
  73. // This definition are correct !
  74.  
  75. #10 =5.23
  76.    #20 =   10.5
  77.  #00=8.3
  78.  
  79. // This definitions are INCORRECT !
  80.  
  81. #1 = 5.23
  82. #01 = 8.23  // Don't put comments in the same line!
  83. #01 = 10  #02 = 20
  84.  
  85. In the first case don't use #1 use #01, in the two others there is something
  86. else in the line.
  87.  
  88. Ej.
  89.  
  90. Input
  91.  
  92. // This is a CORRECT EXAMPLE using var's.
  93.  
  94. #01 = 10
  95. #02 = 0.500
  96. #03 = 0.75
  97.  
  98. #90 = 0.4
  99.  
  100. object {
  101.         sphere { <[@01] [@01/2] 0> [@01/5] }
  102.         texture
  103.         {
  104.          color red [@02] green [@02/2] blue 0  alpha [@03]
  105.          ambient [@90]
  106.         }
  107.        }
  108.  
  109. #01 = 20
  110. #90 = 0.6
  111.  
  112. object {
  113.         sphere { <[@01] [@01/2] 0> [@01/5] }
  114.         texture
  115.         {
  116.          color red [@02] green [@02/2] blue 0  alpha [@03]
  117.          ambient [@90]
  118.         }
  119.        }
  120.  
  121. Output
  122.  
  123. // This is a CORRECT EXAMPLE using var's.
  124.  
  125. //#01 = 10
  126. //#02 = 0.500
  127. //#03 = 0.75
  128.  
  129. //#90 = 0.4
  130.  
  131. object {
  132.         sphere { <10.0000 5.0000 0> 2.0000 }
  133.         texture
  134.         {
  135.          color red 0.5000 green 0.2500 blue 0  alpha 0.7500
  136.          ambient 0.4000
  137.         }
  138.        }
  139.  
  140. //#01 = 20
  141. //#90 = 0.6
  142.  
  143. object {
  144.         sphere { <20.0000 10.0000 0> 4.0000 }
  145.         texture
  146.         {
  147.          color red 0.5000 green 0.2500 blue 0  alpha 0.7500
  148.          ambient 0.6000
  149.         }
  150.        }
  151.  
  152.  
  153. Value format
  154. -----------------------------------------------------------------------------
  155.  
  156.    Prepov use the format (Pascal) d1:d2 when in prints a value, where d1 is
  157. the number of total digits (including the point) and d2 is the number of
  158. digits for the fractional part.
  159.                         Ej
  160.                           12.12:6:3  ==> 12.120
  161.                           0.1  :6:3  ==>  0.100
  162.  
  163.   The default value of d1 and d2 is 4, but you can change where you want
  164. defining two special var's #d1 and #d2.
  165.  
  166. Ej.
  167.  
  168. Input
  169.    sphere {<0 0 [1.18]> 1>}
  170.  
  171.    #d1 = 6
  172.    #d2 = 1
  173.  
  174.    sphere {<0 0 [1.18]> 1>}
  175.  
  176. Ouput
  177.    sphere {<0 0 1.1800> 1>}
  178.  
  179.    #d1 = 6
  180.    #d2 = 1
  181.  
  182.    sphere {<0 0    1.2> 1>}
  183.  
  184.  
  185.  
  186. Formula format
  187. -----------------------------------------------------------------------------
  188.  
  189. You can use any format number like         .1  0.1   1E-01  are all equiv.
  190. and any of these operators : + - * / ^
  191.  
  192. Example [{ (1.0+1)^3/8 } + { (3*3/9.0) }]  = 2  // You can use { and }
  193.  
  194. You can use any of this functions upercase or lowercase:
  195.  
  196.                   PI - ABS - SQRT - SQR - LN - LOG - EXP - FACT
  197.                   SINH - COSH - TANH - SECH - CSCH - COTH
  198.                   SIN - COS - TAN - SEC - CSC - COT - ASIN - ACOS - ATAN
  199.  
  200. The trigonometics functions (Sin,Cos etc..) use radians angles (Pi/2 == 90)
  201.  
  202. Examples
  203.         [Pi*1.0]   = 3.14159
  204.         [FACT(3)]  = 6.00000   // Factorial of 3 = 3! (Can't use real numbers)
  205.         [Sin(Pi/4)]= 0.7071    // Pi/4 in radians == 45 degrees
  206.  
  207.         [{ln(Sin(Pi/4))} + log(sqrt(18.34))] = 0.2851
  208.  
  209.  
  210. Errors
  211. -----------------------------------------------------------------------------
  212.  
  213.   The only errors the program detects are formula errors, when they happen
  214. the program stop with a message printing the formula, the location and the
  215. type of error.
  216.  
  217. Ej
  218.  Input
  219.    #01 = 3
  220.    sphere { <0 0 [Sin(@01*2)+1+*2]> 1}
  221.  
  222.  Ouput (screen)
  223.  
  224.    Sin(3.0000*2)+1+*2
  225.                   ^ Error #2 In Line xxxx
  226.  
  227.  
  228. Error Types
  229.  
  230.    1: Illegal character
  231.    2: Incorrect syntax
  232.    3: Illegal or missing parenthese
  233.    4: Incorrect real format
  234.    5: Illegal function
  235.    6: Result is undefined
  236.    7: Result is too large
  237.    8: Result is complex
  238.    9: Division by zero
  239.  
  240.  
  241. Others
  242. -----------------------------------------------------------------------------
  243.  
  244. I supouse this is a very useful program, if you think it needs something else
  245. like loops or if then estructure, please let me know at compuserve 73050,261
  246. or UUPC @postmaster.cement.edu.ar
  247.  
  248. Sorry for my writing I'am not so good in english.
  249.  
  250. Thank's to all the POV-Team
  251.  
  252.  
  253.  
  254.  
  255.